package org.UserHouse.Servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.UserHouse.Dao.HitemDao;
import org.UserHouse.Dao.Imp.HitemDaoImp;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author bin
 * @date 2024-12-24
 */
@WebServlet("/del.Hitem.do")
public class DeleteHitemServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;charset=UTF-8");
        PrintWriter out = resp.getWriter();

        int hid = Integer.parseInt(req.getParameter("Hid"));

        HitemDao hitemDao = new HitemDaoImp();
        int n = hitemDao.DeleteHitem(hid);
        out.println(n);

        out.flush();
        out.close();
    }
}
